package com.hex.ds.hdtp.core.web.common.page;

/**
 * @author lwz
 * @date 2021-08-05
 * @des
 */
public class PageVo {
    private int pageIndex = 0;
    private int pageSize = 10;
    private long total = 0L;
    private String sort;

    /**
     * @Method PageVo
     * @Param
     * @Return
     * @Description 构造
     * @Author gj.xu
     * @Date 2024/3/4 18:15
     * @Version V2.0
     */
    public PageVo() {
        // Do nothing
    }

    public int getPageIndex() {
        return this.pageIndex + 1;
    }

    public void setPageIndex(int pageIndex) {
        if (pageIndex < 0) {
            this.pageIndex = 0;
        } else {
            this.pageIndex = pageIndex;
        }

    }

    public int getPageSize() {
        return this.pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getOffset() {
        return this.getPageIndex() * this.pageSize;
    }

    public long getTotal() {
        return this.total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public String getSort() {
        return this.sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public void setPage(int page) {
        this.pageIndex = page;
    }

    public void setSize(int size) {
        this.pageSize = size;
    }
}
